<template>
  <div></div>
</template>

<script>
import QRCode from 'qrcodejs2';
export default {
  props: {
    options: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      
    };
  },
  watch: {
    options: {
      handler(next) {
        console.log('handler')
        this.creatQrCode()
      },
      deep: true
    }
  },
  methods: {
    creatQrCode() {
      this.$el.innerHTML = ''
      new QRCode(this.$el, {
        text: ``,
        width: 100,
        height: 100,
        colorDark: "#333333", //二维码颜色
        colorLight: "#ffffff", //二维码背景色
        correctLevel: QRCode.CorrectLevel.L,//容错率，L/M/H
        ...this.options
      })
    }
  },
  mounted() {
    this.creatQrCode()
  }
};
</script>
<style lang="scss" scoped>

</style>